import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  //示例默认页面： ‘/’时路由的页面（默认页面）
  // { path: '/', redirect: '/home' },

  {
    path: '/',
    name: 'layout',
    component: () => import('@/views/home/index.vue'),
    redirect: '/dashboard',
    children: [
      /**本项目动态路由会动态添加在此 */
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '/settle',
    name: 'settle',
    component: () => import('@/views/settle/index.vue')
  },
  {
    path: '/success',
    name: 'success',
    component: () => import('@/views/settle/success/index.vue')
  }
]
// 为某个动态路由添加子路由
export const subRouteForDynamicRouting = {
  // '/dish': {
  //   path: 'save',
  //   name: 'addDish',
  //   meta: {
  //     title: '添加菜品',
  //     hidden: true
  //   },
  //   component: () => import('@/views/home/dish/save-dish.vue')
  // }
}
export default createRouter({
  history: createWebHistory(),
  routes
})
